<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admenvsupp.php,v $ 
 * $Date: 2005/08/29 14:56:04 $ 
 * $Revision: 1.2 $ 
 * 
 * ********* CVS HEADER ********* 
 */
if (!isset($argid)) {
	rportalerreur("Aucun environnement en param&egrave;tre !","?op=admenvliste");
}
$L_base_env = get_env_path();
if($confirm==1) {
	$query="UPDATE groupe SET id_environnement='$new_env' WHERE id_environnement='$argid'";
	$result=rportalrequete($query) or rportalerreur($query,"?op=admenvliste");
	$query="DELETE FROM environnement WHERE id='$argid'";
	$result=rportalrequete($query) or rportalerreur($query,"?op=admenvliste");
	header("Location: ?op=admenvliste");
	exit();
}
require_once(get_path("module")."TPLN/TPLN.php");
$TPLN = new TPLN;
$TPLN->Open($op_basepath.get_path("tpl")."admenvsupp.html");
$TPLN->IncludeFile("header",$L_base_env.$session['environnement']."/header.php");
$query="SELECT nom,description FROM environnement WHERE id='$argid'";
$result=rportalrequete($query) or rportalerreur($query,"?op=admenvliste");
if(!$row=rportalligne($result)) {
	rportalerreur($query,"?op=admenvliste");
}

$TPLN->Parse("argid", $argid);
$TPLN->Parse("nom", $row['nom']);
$TPLN->Parse("description", $row['description']);
$query="SELECT id,nom from environnement WHERE id!='$argid' GROUP BY id";
$result=rportalrequete($query) or rportalerreur($query,"?op=admenvliste");
while($row=rportalligne($result)) {
	$TPLN->Parse("bloc1.option_id",$row['id']);
	$TPLN->Parse("bloc1.option_nom",$row['nom']);
	$TPLN->Loop("bloc1");
}
$TPLN->IncludeFile("footer",$L_base_env.$session['environnement']."/footer.php");
$TPLN->Write();
?>